<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui">

    <ui:composition template="/template.xhtml">
        <ui:define name="title">
            <h:outputText value="#{bundle.ListCarreservationTitle}"></h:outputText>
        </ui:define>
        <ui:define name="body">
        <h:form styleClass="jsfcrud_list_form">
            <h:panelGroup id="messagePanel" layout="block">
                <h:messages errorStyle="color: red" infoStyle="color: green" layout="table"/>
            </h:panelGroup>
            <p:dataTable value="#{carreservationController.items}" var="item" paginator="true" paginatorPosition="bottom" styleClass="test">
                    <p:column>
                        <f:facet name="header">
                            <h:outputText value="#{bundle.ListCarreservationTitle_idCarReservation}"/>
                        </f:facet>
                        <h:outputText value="#{item.idCarReservation}"/>
                    </p:column>
                    <p:column>
                        <f:facet name="header">
                            <h:outputText value="#{bundle.ListCarreservationTitle_deposit}"/>
                        </f:facet>
                        <h:outputText value="#{item.deposit}"/>
                    </p:column>
                    <p:column>
                        <f:facet name="header">
                            <h:outputText value="#{bundle.ListCarreservationTitle_car}"/>
                        </f:facet>
                        <h:outputText value="#{item.car}"/>
                    </p:column>
                    <p:column>
                        <f:facet name="header">
                            <h:outputText value="Pick up location"/>
                        </f:facet>
                        <h:outputText value="#{item.pickUpLocation.address}"/>
                    </p:column>
                    <p:column>
                        <f:facet name="header">
                            <h:outputText value="Pick up date"/>
                        </f:facet>
                        <h:outputText value="#{item.pickUpDate}">
                            <f:convertDateTime pattern="MM/dd/yyyy" />
                        </h:outputText>
                    </p:column>
                    <p:column headerText="Customer">
                        <h:outputText value="#{item.customer.username}"/>
                    </p:column>
                    <p:column>
                        <f:facet name="header">
                            <h:outputText value="&nbsp;"/>
                        </f:facet>
                        <h:commandLink action="#{carreservationController.prepareView(item)}" value="#{bundle.ListCarreservationViewLink}"/>
                        <h:outputText value=" "/>
                        <h:commandLink action="#{carreservationController.prepareEdit(item)}" value="#{bundle.ListCarreservationEditLink}"/>
                        <h:outputText value=" "/>
                        <h:commandLink action="#{carreservationController.destroy(item)}" value="#{bundle.ListCarreservationDestroyLink}"/>
                    </p:column>
            </p:dataTable>
            
            <br />
            <h:commandLink action="#{carreservationController.prepareCreate}" value="#{bundle.ListCarreservationCreateLink}"/>
        </h:form>            
        </ui:define>
    </ui:composition>

</html>
